package com.qgz.googleapp.web.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.qgz.framework.BeanFactory;
import com.qgz.googleapp.entity.User;
import com.qgz.googleapp.service.UserService;



public class UserServlet extends HttpServlet {

	public void doGet(HttpServletRequest req, HttpServletResponse resp) {

	}

	public void doPost(HttpServletRequest req, HttpServletResponse resp) {
				
		UserService userService = BeanFactory.getInstance(UserService.class);
		
		userService.AddNewUser("qiliantian@163.com", "123");
		
		User u = userService.getUser("qiliantian@163.com");
		
		PrintWriter p;
		try {
			p = resp.getWriter();
			p.print("get user:"+u.getEmail() +" password:" +u.getPassword());
			System.out.println("get user:"+u.getEmail() +" password:" +u.getPassword());
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}
